package com.szxy.common.redis.controller;

import com.szxy.common.redis.service.ContentRedisService;
import com.szxy.common.redis.service.ItemCatRedisService;
import com.szxy.utils.CatResult;
import com.szxy.utils.ContentAD;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Auther:zwer
 * @Date:2019/9/11 11:21
 * @Description:com.szxy.common.redis
 * @Version:1.0
 **/
@RestController
@RequestMapping("/service/redis")
public class RedisController {

    @Autowired
    private ItemCatRedisService itemCatRedisService;
    @Autowired
    private ContentRedisService contentRedisService;

    /**
     * 插入商品分类目录
     */
    @RequestMapping("/insertItemCatResult")
    public void insertItemCatResult(@RequestBody  CatResult result){
        this.itemCatRedisService.insertItemCatResult(result);
    }

    /**
     * 获取商品分类目录
     */
    @RequestMapping("/getItemCatResult")
    public CatResult getItemCatResult(){
        return this.itemCatRedisService.getItemCatResult();
    }

    /**
     * 插入首页AD大广告
     */
    @RequestMapping("/insertContentAD")
    public void insertContentAD(@RequestBody List<ContentAD> contentADList){
        this.contentRedisService.insertContentAD(contentADList);
    }

    /**
     * 获取商品分类目录
     */
    @RequestMapping("/getContentAD")
    public List<ContentAD> getContentAD(){
        return this.contentRedisService.getItemCatResult();
    }



}
